package com.yc.movie.web.controller;


import com.yc.movie.service.IMovieInfoService;
import com.yc.movie.service.impl.MovieInfoServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@WebServlet("/movie")
public class MovieInfoController extends BaseController {



    private IMovieInfoService service = new MovieInfoServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         req.setCharacterEncoding("UTF-8");
         resp.setCharacterEncoding("UTF-8");
         String op = req.getParameter("op");
         if("finds".equals(op)){
             doFinds(req,resp);
         }
         else{
             printToJson(resp,"NO method ......");
         }


    }

    private void doFinds(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        Map<String,Object> map =parseRequest(req);
        Map<String,Object> m =service.finds(map);
        printToJson(resp,m);


    }
}
